<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>编辑博客</title>
    <link rel="stylesheet" href="CSS/common.css"> 
    <link rel="stylesheet" href="CSS/blomng-edit-container.css">
   
   
    <link rel="stylesheet" href="editor.md/css/editormd.min.css" />
    <script src="js/jquery.min.js"></script>
    <script src="editor.md/lib/marked.min.js"></script>
    <script src="editor.md/lib/prettify.min.js"></script>
    <script src="editor.md/editormd.js"></script>
</head>
<body>
    <!-- 这是博客编辑页面 -->
    <!-- 导航栏 -->
    <div class="nav">
        <img src="imger/2.jpg" alt="这是一个logo图标">
        <span class="title">我的博客系统</span>
        <!-- 用来空出中间的位置 -->
        <span class="spacer"></span>
        <a href="blong.html">主页</a>
        <a href="blong_2.html">写博客</a>
        <a href="logout">注销</a>
    </div>
    <div class="blog-edit-container">
        <form action="blog" method="post" style="height: 100%;">
            <div class="title">
                <input type="text" id="title" placeholder="在此处输入标题" name="title">
                <input type="submit" id="submit" value="发布文章">
            </div>
            <!-- 放置编译器 -->
            <div  id="editor">
                <textarea name="content" style="display: none"></textarea>
            </div>
        </form>
        
    </div>


    <script>
       let editor = editormd("editor", {
            // 这里的尺寸必须在这里设置. 设置样式会被 editormd 自动覆盖掉. 
            width: "1000px",
            // 设定编辑器高度
            height: "calc(100%-50px)",
            // 编辑器中的初始内容
            markdown: "# 在这里写下一篇博客",
            // 指定 editor.md 依赖的插件路径
            path: "editor.md/lib/"
        });
        function chekLogin(){
            $.ajax({
                type:'get',
                url:'login',
                
                success:function(body){
                    if(body.userId && body.userId>0){
                        console.log("当前用户已登录");
                    }else{
                        location.assign('login.html');
                    }
                }

            });
        }
        chekLogin();
    </script>
</body>
</html>